//
//  FLLButtonAndLabelView.m
//  FLLGodOfCookery
//
//  Created by LL.F on 16/8/30.
//  Copyright © 2016年 LL.F. All rights reserved.
//

#import "FLLButtonAndLabelView.h"
#import "Masonry.h"
#import "UILabel+FLLSetPropety.h"

@interface FLLButtonAndLabelView ()

@end

@implementation FLLButtonAndLabelView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.topButton = [UIButton buttonWithType:UIButtonTypeSystem];
        [self addSubview:_topButton];
        
        self.bottomLabel = [[UILabel alloc] init];
        [_bottomLabel setPropetyWithTextColor:[UIColor grayColor] Alignment:1 textFont:[UIFont systemFontOfSize:14]];
        [self addSubview:_bottomLabel];
    }
    return self;
}
- (void)layoutSubviews
{

    [super layoutSubviews];
    [_topButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_equalTo(0);
        make.height.mas_equalTo(70);
        
    }];
    
    [_bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.top.mas_equalTo(_topButton.mas_bottom);
    }];

    

}
- (void)setButtonImage:(UIImage *)buttonImage labelText:(NSString *)labelText
{

    [self.topButton setImage:buttonImage forState:UIControlStateNormal];
    self.bottomLabel.text = labelText;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
